From: Florian Müllner Date: Wed, 22 Jan 2020 14:09:05 +0000 (+0100) Subject: extensionSystem: Install pending updates on startup X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~96 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=db9ef11f2893eae0905b091be361ff5417156beb;p=gnome-shell.git extensionSystem: Install pending updates on startup Now that we have a way to check for updates and download them, we should actually apply them as well. Do this on startup before any extensions are initialized, to make sure we don't run into any conflicts with a previously loaded version. https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/945 --- diff --git a/js/ui/extensionSystem.js b/js/ui/extensionSystem.js index 49e333fff..432859733 100644 --- a/js/ui/extensionSystem.js +++ b/js/ui/extensionSystem.js @@ -45,6 +45,7 @@ var ExtensionManager = class { return GLib.SOURCE_REMOVE; }); + this._installExtensionUpdates(); this._sessionUpdated(); } @@ -456,6 +457,21 @@ var ExtensionManager = class { }).forEach(extension => this.reloadExtension(extension)); } + _installExtensionUpdates() { + FileUtils.collectFromDatadirs('extension-updates', true, (dir, info) => { + let fileType = info.get_file_type(); + if (fileType !== Gio.FileType.DIRECTORY) + return; + let uuid = info.get_name(); + let extensionDir = Gio.File.new_for_path( + GLib.build_filenamev([global.userdatadir, 'extensions', uuid])); + + FileUtils.recursivelyDeleteDir(extensionDir, false); + FileUtils.recursivelyMoveDir(dir, extensionDir); + FileUtils.recursivelyDeleteDir(dir, true); + }); + } + _loadExtensions() { global.settings.connect(`changed::${ENABLED_EXTENSIONS_KEY}`, this._onEnabledExtensionsChanged.bind(this));